package com.lwc.cfdns.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.lwc.cfdns.pojo.BaseEntity;

import java.io.Serializable;
import java.util.Date;

import com.lwc.cfdns.pojo.dto.ValidGroup;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 后台组合数据表
 *
 * @TableName cfdns_system_group
 */
// json 字段处理https://baomidou.com/pages/fd41d8/
@TableName(value = "cfdns_system_group", autoResultMap = true)
@Data
public class SystemGroup extends BaseEntity implements Serializable {
    /**
     * 组合数据ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    @NotNull(message = "ID不能为空", groups = {ValidGroup.Update.class})
    private Long id;

    /**
     * 系统配置分类id
     */
    private Long cateId;

    /**
     * 数据组名称
     */
    @NotBlank(message = "名称不能为空", groups = {ValidGroup.Create.class, ValidGroup.Update.class})
    private String name;

    /**
     * 数据提示
     */
    private String info;

    /**
     * 组合标识
     */
    @NotBlank(message = "组合标识不能为空", groups = {ValidGroup.Create.class, ValidGroup.Update.class})
    private String gkey;

    /**
     * 数据组字段以及类型（json数据）
     */
    @NotNull(message = "数组字段及类型不能为空", groups = {ValidGroup.Create.class, ValidGroup.Update.class})
    @TableField(value = "fields", typeHandler = JacksonTypeHandler.class)
    private Object fields;

    /**
     * 显示顺序
     */
    private Integer sort = 0;

    /**
     * 备注
     */
    private String remark;

    /**
     * 状态 0正常 1禁用
     */
    private String status = "0";

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}